import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useTokenStore = defineStore('token', () => {
    //定义状态内容

    //响应式变量
    const thoken = ref('') // 在pinaia中定义响应式变量,thoken不需要.value

    //定义方法，修改thoken
    const setThoken = (token) => {
        thoken.value = token
    }
    //移除thoken
    const removeThoken = () => {
        thoken.value = ''
    }

    //返回
    return {
        thoken,
        setThoken,
        removeThoken
    }



},
    {
        persist: true, //持久化
    }

);